// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.statement.SQLPrimaryKey;
// import com.alibaba.druid.sql.ast.statement.SQLPrimaryKeyImpl;
// import com.alibaba.druid.sql.ast.statement.SQLTableConstraint;
// import com.alibaba.druid.sql.ast.statement.SQLTableElement;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "OraclePrimaryKey.h"
#include "../../../../ast/SQLName.h"
#include "../../../../visitor/SQLASTVisitor.h"
#include "../../visitor/OracleASTVisitor.h"
#include "OracleUsingIndexClause.h"
#include "../../../../ast/statement/SQLSelectOrderByItem.h"
#include "../../../../../utils/listTran.h"

// @Override
void OraclePrimaryKey::accept0(SQLASTVisitor_ptr visitor)
{
  this->accept0(std::dynamic_pointer_cast<OracleASTVisitor>(visitor));
}

// @Override
void OraclePrimaryKey::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OraclePrimaryKey)))
  {
    acceptChild(visitor, SQLUnique::getName());
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLSelectOrderByItem, SQLObject>(getColumns());
    acceptChild(visitor, tmp1);
    acceptChild(visitor, using_);
    acceptChild(visitor, exceptionsInto);
  }
  visitor->endVisit(SharedObject(OraclePrimaryKey));
}

BOOL_ptr OraclePrimaryKey::getDeferrable()
{
  return deferrable;
}

void OraclePrimaryKey::setDeferrable(BOOL_ptr deferrable)
{
  this->deferrable = deferrable;
}

OracleUsingIndexClause_ptr OraclePrimaryKey::getUsing()
{
  return using_;
}

void OraclePrimaryKey::setUsing(OracleUsingIndexClause_ptr using_)
{
  this->using_ = using_;
}

SQLName_ptr OraclePrimaryKey::getExceptionsInto()
{
  return exceptionsInto;
}

void OraclePrimaryKey::setExceptionsInto(SQLName_ptr exceptionsInto)
{
  this->exceptionsInto = exceptionsInto;
}

BOOL_ptr OraclePrimaryKey::getEnable()
{
  return enable;
}

void OraclePrimaryKey::setEnable(BOOL_ptr enable)
{
  this->enable = enable;
}

OracleConstraint_Initially_ptr OraclePrimaryKey::getInitially()
{
  return initially;
}

void OraclePrimaryKey::setInitially(OracleConstraint_Initially_ptr initially)
{
  this->initially = initially;
}

void OraclePrimaryKey::cloneTo(OraclePrimaryKey_ptr x)
{
  SQLPrimaryKeyImpl::cloneTo(x);
  if (using_ != nullptr)
  {
    x->setUsing(std::dynamic_pointer_cast<OracleUsingIndexClause>(using_->clone()));
  }
  if (exceptionsInto != nullptr)
  {
    x->setExceptionsInto(std::dynamic_pointer_cast<SQLName>(exceptionsInto->clone()));
  }
  x->enable = enable;
  x->initially = initially;
  x->deferrable = deferrable;
}

SQLObject_ptr OraclePrimaryKey::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<OraclePrimaryKey>(new OraclePrimaryKey());
  std::shared_ptr<OraclePrimaryKey> x = std::dynamic_pointer_cast<OraclePrimaryKey>(clone_tmp);
  // OraclePrimaryKey x = new OraclePrimaryKey();
  cloneTo(x);
  return x;
}
